#include<bits/stdc++.h>
using namespace std;
#define sd(n) scanf("%d",&n)
typedef long long int ll;

void solve()
{
	int n, a, k, b, m;//超过k，每天长a，修成b
	vector<int> v;
	sd(n);
	for (int i = 0; i < n; i++)
	{
		int tmp = 0;
		sd(tmp);
		v.push_back(tmp);
	}
	sd(a), sd(k), sd(b), sd(m);
	for (int i = 0; i < m-1; i++)
	{
		for (auto& x : v)
		{
			if (x > k) x = b;
			x += a;
		}
	}
	for (auto& x : v)
	{
		if (x > k) x = b;
	}
	for (auto& x : v) cout << x << " ";
	puts("");

}


int main()
{
	int t;
	sd(t);
	while (t--)
	{
		solve();
	}

	return 0;
}